Skip to content

Conversation

cratelyn
Copy link
Contributor

this commit introduces a small accessor to the Family<S, M, C> metric family type. this new contains() method allows callers to check whether or not a metric with the provided set of labels exists.

if no metric has been created via e.g. get_or_create(), this method will return false.

this commit introduces a small accessor to the `Family<S, M, C>` metric
family type. this new `contains()` method allows callers to check
whether or not a metric with the provided set of labels exists.

if no metric has been created via e.g. `get_or_create()`, this method
will return `false`.

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit to cratelyn/prometheus-client that referenced this pull request Nov 18, 2024
this commit introduces a `len()` method to `Family<S, M, C>`, which
returns the number of series within a metric family.

see also prometheus#245, which allows callers to check if a family `contains()` a
given label set.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn
Copy link
Contributor Author

cratelyn commented Sep 2, 2025

my understanding is that this could be added behind the test-util flag proposed in #283.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant